<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 与对应负数同时存在的最大正整数 -->
    <script>
      var findMax = function (nums) {
        let set = new Set()
        let max = -1
        for (let num of nums) {
          //是否包含指定的值
          if (set.has(num)) {
            //ads返回绝对值
            max = Math.max(max, Math.abs(num))
          } else {
            //添加指定的元素  每个元素必须有一个唯一的值
            set.add(-num)
          }
        }
        return max
      }
      console.log(findMax([-1, 2, -3, 3]))
    </script>
  </body>
</html>
